package com.jx.common.job;

import com.jx.service.statistics.StatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class StatisticsJob {

    @Resource
    private StatisticsService statisticsService;

    @Scheduled(cron = "0 46 21 * *  ?")
    public void syncPV() {
        log.info("开始uv归档");
        statisticsService.syncPVCacheToDb();
        log.info("uv归档成功");
    }

    @Scheduled(cron = "0 48 17 * *  ?")
    public void syncUV() {
        log.info("开始pv归档");
        statisticsService.syncUVCacheToDb();
        log.info("pv归档成功");
    }

}
